package com.ch.d0301zy;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "GetInformationServlet", value = "/GetInformationServlet")
public class GetInformationServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");

        PrintWriter out = response.getWriter();

        HttpSession session = request.getSession();

        String[] likes1 = (String[])session.getAttribute("likes");
        Object edu1 = session.getAttribute("edu");
        Object experience = session.getAttribute("experience");
        out.printf("爱好:");
        out.print("<ul>");
        for(String s : likes1){
            out.printf("<li> %s ",s);
        }
        out.printf("</ul>");

        out.printf("<br>");


        out.printf("学历：%s" , edu1);
        out.printf("<br>");

        out.printf("教育经历: %s",experience);


    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
